//PITCH PROGRAM
//CLASS: SCOREPANEL
//		- set panel for scores
//BY: ALEX TRACY
import java.awt.Color;
import java.awt.Graphics;
import java.util.Vector;
import javax.swing.JPanel;


public class ScorePanel extends JPanel
{
	private static Vector<Integer> usScore = new Vector<Integer>();
	private static Vector<Integer> themScore = new Vector<Integer>();
	
	public ScorePanel()
	{
		setBackground(Color.WHITE);
	}
	
	//paint panel by drawing a line down the middle
	//and drawing all scores in team score arrays
	//every four hands draw a line
	public void paintComponent(Graphics g)
	{
		super.paintComponent(g);
		g.setColor(Color.BLACK);
		g.drawString("Us",10,20);
		g.drawString("Them", 70, 20);
		g.drawLine(50,0,50,480);
		
		for(int i = 0 ; i < usScore.size();i++)
		{
			if ( i % 4 == 0)
				g.drawLine(0, 21 * (i + 1), 150, 21 * (i+1));
			g.drawString(Integer.toString(usScore.get(i)), 15, 20 * (i+2));
			g.drawString(Integer.toString(themScore.get(i)), 77, 20 * (i + 2));
			
		}
		
	}//End paintComponent
	
	//update scores from team score arrays
	public static void updateScores(Vector<Integer> us, Vector<Integer> them)
	{
		usScore.clear();
		themScore.clear();
		usScore.addAll(us);
		themScore.addAll(them);
	}//End updateScores
	
}//End ScorePanel
